﻿
Partial Class App_FollowersOverview
    Inherits MyUI.PageBaseApp

    Public CurrAccount As mDB.Account
    Protected SortGridLocations As UI.SortControl

    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load

        SortGridLocations = New UI.SortControl(Me.GridUsers.ID, Me.ViewState, "Accuracy", SortDirection.Descending)

        CurrAccount = CurrUser.CurrAccount

        If Not Me.IsPostBack Then
            SetDataPage()
        End If


    End Sub

    Private Sub SetDataPage()

        If CurrAccount IsNot Nothing Then
            Me.SetDataCharActivity()

            Me.SetDataListAccount()
        End If


    End Sub

    '#Region "ACCOUNT"
    '    Protected Sub AccountSelect_SelectedChanged() Handles AccountSelect.SelectedChanged
    '        SetDataPage()
    '    End Sub
    '#End Region

#Region "WIDGET"
    Private Sub SetDataCharActivity()

        Dim s1 = CurrAccount.Tab_Categorize_Follower.
          REL.Categorize_Follower.categorize.
          OrderBy("Description").Limit(10).ToDataTable


        'MyUI.Charts.SetGeoChart(Me.ChartActivity)


        'With Me.ChartActivity


        '    With .ChartAreas("Area1")
        '        .AxisX.IsMarginVisible = False
        '        .AxisY.IsMarginVisible = False
        '        .AxisX.IsStartedFromZero = True
        '        .AxisX.Interval = 1
        '        .AxisY.IsStartedFromZero = True
        '        '.AxisX.LabelStyle.Format = "00"
        '        .AxisY.LabelStyle.Format = UI.Print.FNum(0)
        '        .AxisX.IsLabelAutoFit = False

        '    End With

        '    .Series.Add(MyUI.Charts.DefautSerie(1, DataVisualization.Charting.SeriesChartType.Column))

        '    With .Series("Series1")
        '        .Item("PointWidth") = "0.6"
        '        '.Points.DataBindXY(xValues, yValues1)
        '        .Points.DataBindXY(s1.Rows, "description", s1.Rows, "account_count")
        '        .BorderWidth = 1
        '        .Color = Utils.Color.ToCol("#4DB849")
        '        .LegendText = "Engagement"
        '        .ChartArea = "Area1"
        '    End With



        '    '.Legends.Add(MyUI.Charts.DefautLegend())
        '    Dim colors = {"#8CC63E", "#FFD203", "#C2272D", "#29AAE3", "#662E91", "#8CC63E", "#FFD203", "#C2272D", "#29AAE3", "#662E91"}

        '    Dim series As DataVisualization.Charting.Series
        '    For Each series In .Series
        '        Dim pointIndex As Integer
        '        For pointIndex = 0 To series.Points.Count - 1
        '            Dim toolTip As String = ""
        '            toolTip = SF("{0}: {1} account", series.Points(pointIndex).AxisLabel, series.Points(pointIndex).YValues(0))
        '            series.Points(pointIndex).Color = Utils.Color.ToCol(colors(pointIndex))
        '            series.Points(pointIndex).MapAreaAttributes = "onmouseover=""DisplayTooltip('" + toolTip + "');"" onmouseout=""DisplayTooltip('');"""
        '            series.Points(pointIndex).Url = "?q=" & s1.Rows(pointIndex)("Id") & "#FollowersOverview"
        '        Next pointIndex
        '    Next


        'End With

        Me.UpPCharActivity.Update()


    End Sub
#End Region

#Region "ACCOUNT LIST"

    Public Sub SetDataListAccount()

        Dim q = UI.Page.GetValueInt("q")
        'Dim List = CurrAccount.Tab_Categorize_Follower.GetByPK(q)

        If q > 0 Then

            '        Dim UserList = DB.TAB.AccountList.BY.AccountList.UserId(CurrUser.Id, 1).ToObj

            Dim DtAcc = SortGridLocations.SortQuery(
                DB.TAB.Account.
                REL.Account.Account_Update.
                REL.Account.categorize_Account.
                BY.Categorize_Account.Account_Id(CurrAccount.Id, q)
            ).
            ToDataTable()

            Me.GridUsers.PageSize = 30
            UI.Grid.Bind(Me.GridUsers, DtAcc)
        Else

            UI.Grid.Bind(Me.GridUsers, Nothing)
        End If


    End Sub

#End Region



End Class
